#include "Frm10.h"

Frm10::Frm10(HmiApp* app, STTWidget *par, const string& id, const string& desc) : STTPage(app->getRuntime(), par, id, desc) {
	hmiApp = app;
}

Frm10::~Frm10() {
}

void Frm10::onInit() {

}

void Frm10::createParts() {
	setMainArg(0, 0, 1024, 600);
	setMainStyle(0, 0xffffff, 0xffffff, 0, 255, 0, 0xc0c0c0);

	/*----------------------------- MButton : wMMButton1                 -----------------------------*/
	wMMButton1 = new STTButton(p_rt, this, "wMMButton1", 1);
	wMMButton1->setMainArg(0, 0, 93, 60, false);
	wMMButton1->setImg("1", "./images/arrow_34_93X60.gray.svg", "");
	wMMButton1->setImg("0", "./images/arrow_34_93X60.svg", "");
	wMMButton1->bindOpenFormHandler(Event::CLICKED, "Frm01", PageMode::NEWWIN, NULL);

	/*----------------------------- HistoryTrend : wMHistoryTrend1       -----------------------------*/
	wMHistoryTrend1 = new STTHistoryTrend(p_rt, this, "wMHistoryTrend1");
	wMHistoryTrend1->setMainArg(0, 60, 512, 270, 1, 301, 4, 5, 12, "文泉驿微米黑", 0x0, 0);
	wMHistoryTrend1->setMainStyle(0, 0xffffff, 0xffffff, 0, 0, 0xc0c0c0, 0, 0x0, 50, 50, 20, 50);
	wMHistoryTrend1->setFractionLen(0, 0, 0);
	wMHistoryTrend1->setXAxis(0, 0, 7, 1, true, "\n\n\n\n\n\n\n");
	wMHistoryTrend1->setYAxis(0, 0, 6, 1, true, "100\n80\n60\n40\n20\n0", 0, 100);
	wMHistoryTrend1->setY2Axis(0, 0, 2, 1, true, "\n", 0, 100);
	wMHistoryTrend1->setChartBgStyle(0, 0xf0f0f0, 0xffffff, 0, 1, 0xc0c0c0, 2, 2, 1, 0xc0c0c0, 5, 0);
	wMHistoryTrend1->setTickStyle(1, 0xc0c0c0);
	wMHistoryTrend1->hideSeries(wMHistoryTrend1->setAddSeries(0, 0x80ff, NULL, 0, 100), false);
	wMHistoryTrend1->hideSeries(wMHistoryTrend1->setAddSeries(0, 0xff, NULL, 0, 100), false);
	wMHistoryTrend1->setDataSource("1", "", true, "温度;湿度", "{\"m\":\"0\",\"mv\":\"\",\"xu\":\"3\",\"xs\":\"60\",\"xsu\":\"0\",\"xsv\":\"\",\"y2n\":\"\",\"y2m\":\"\"}");
	wMHistoryTrend1->startCollect();

	/*----------------------------- Label : wMLabel1                     -----------------------------*/
	wMLabel1 = new STTLabel(p_rt, this, "wMLabel1");
	wMLabel1->setMainArg(213, 60, 86, 23, "实时数据", TextAlign::LEFT, LabelLongMode::CLIP, 30);
	wMLabel1->setFonts(0x0, 16, "文泉驿微米黑", 0);
	wMLabel1->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMLabel1->setFormatText(TextAlign::LEFT, LabelLongMode::CLIP, 30);

	/*----------------------------- HistoryTrend : wMHistoryTrend3       -----------------------------*/
	wMHistoryTrend3 = new STTHistoryTrend(p_rt, this, "wMHistoryTrend3");
	wMHistoryTrend3->setMainArg(511, 60, 512, 270, 1, 301, 4, 5, 12, "文泉驿微米黑", 0x0, 0);
	wMHistoryTrend3->setMainStyle(0, 0xffffff, 0xffffff, 0, 0, 0xc0c0c0, 0, 0x0, 50, 50, 20, 50);
	wMHistoryTrend3->setFractionLen(0, 0, 0);
	wMHistoryTrend3->setXAxis(0, 0, 7, 1, true, "\n\n\n\n\n\n\n");
	wMHistoryTrend3->setYAxis(0, 0, 6, 1, true, "100\n80\n60\n40\n20\n0", 0, 100);
	wMHistoryTrend3->setY2Axis(0, 0, 2, 1, true, "\n", 0, 100);
	wMHistoryTrend3->setChartBgStyle(0, 0xf0f0f0, 0xffffff, 0, 1, 0xc0c0c0, 2, 2, 1, 0xc0c0c0, 5, 0);
	wMHistoryTrend3->setTickStyle(1, 0xc0c0c0);
	wMHistoryTrend3->hideSeries(wMHistoryTrend3->setAddSeries(0, 0x80ff, NULL, 0, 100), false);
	wMHistoryTrend3->hideSeries(wMHistoryTrend3->setAddSeries(0, 0xff, NULL, 0, 100), false);
	wMHistoryTrend3->setDataSource("1", "", false, "温度;湿度", "{\"m\":\"0\",\"mv\":\"\",\"xu\":\"3\",\"xs\":\"60\",\"xsu\":\"0\",\"xsv\":\"\",\"y2n\":\"\",\"y2m\":\"\"}");

	/*----------------------------- Label : wMLabel3                     -----------------------------*/
	wMLabel3 = new STTLabel(p_rt, this, "wMLabel3");
	wMLabel3->setMainArg(724, 60, 86, 23, "历史数据", TextAlign::LEFT, LabelLongMode::CLIP, 30);
	wMLabel3->setFonts(0x0, 16, "文泉驿微米黑", 0);
	wMLabel3->setMainStyle(0, 0xffffff, 0xffffff, GradDir::NONE, 0, 0x0, 0);
	wMLabel3->setFormatText(TextAlign::LEFT, LabelLongMode::CLIP, 30);

	/*----------------------------- Table : wMTable1                     -----------------------------*/
	wMTable1 = new STTTable(p_rt, this, "wMTable1");
	wMTable1->setMainArg(0, 329, 512, 240, "SID,序号,64;STIME,时间,246;D1,温度,98;D2,湿度,97", 7, false, 0);
	wMTable1->setHeadCellStyle(0xf0f0f0, 0xffffff, 0, 1, 0xd0d0d0, 5, 5, 0, 0, 0x0, 16, "文泉驿微米黑", 0);
	wMTable1->setSelCellStyle(0x1a2b3, 0xffffff, 0, 1, 0xd0d0d0, 5, 5, 0, 0, 0x0, 16, "文泉驿微米黑", 0);
	wMTable1->setDataCellStyle(0xffffff, 0xffffff, 0, 1, 0xd0d0d0, 5, 5, 0, 0, 0x0, 16, "文泉驿微米黑", 0);
	wMTable1->setDataSource("1", "", false);

	/*----------------------------- Table : wMTable2                     -----------------------------*/
	wMTable2 = new STTTable(p_rt, this, "wMTable2");
	wMTable2->setMainArg(512, 329, 512, 240, "SID,序号,56;STIME,时间,259;D1,温度,98;D2,湿度,97", 7, false, 1);
	wMTable2->setHeadCellStyle(0xf0f0f0, 0xffffff, 0, 1, 0xd0d0d0, 5, 5, 0, 0, 0x0, 16, "文泉驿微米黑", 0);
	wMTable2->setSelCellStyle(0x1a2b3, 0xffffff, 0, 1, 0xd0d0d0, 5, 5, 0, 0, 0x0, 16, "文泉驿微米黑", 0);
	wMTable2->setDataCellStyle(0xffffff, 0xffffff, 0, 1, 0xd0d0d0, 5, 5, 0, 0, 0x0, 16, "文泉驿微米黑", 0);
	wMTable2->setDataSource("1", "", false);

	/*----------------------------- Button : wMButton1                   -----------------------------*/
	wMButton1 = new STTButton(p_rt, this, "wMButton1", 0);
	wMButton1->setMainArg(145, 1, 48, 28, false);
	wMButton1->setPressedArg("|<", 0x0, "文泉驿微米黑", 16, 0);
	wMButton1->setPressedStyle(8, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton1->setReleasedArg("|<", 0x0, "文泉驿微米黑", 16, 0);
	wMButton1->setReleasedStyle(5, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton1->onEventHandler(Event::CLICKED, this, (EHandler) &Frm10::wMButton1_clk_cb);

	/*----------------------------- Button : wMButton2                   -----------------------------*/
	wMButton2 = new STTButton(p_rt, this, "wMButton2", 0);
	wMButton2->setMainArg(194, 1, 48, 28, false);
	wMButton2->setPressedArg("<", 0x0, "文泉驿微米黑", 16, 0);
	wMButton2->setPressedStyle(8, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton2->setReleasedArg("<", 0x0, "文泉驿微米黑", 16, 0);
	wMButton2->setReleasedStyle(5, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);

	/*----------------------------- Button : wMButton3                   -----------------------------*/
	wMButton3 = new STTButton(p_rt, this, "wMButton3", 0);
	wMButton3->setMainArg(243, 1, 48, 28, false);
	wMButton3->setPressedArg(">", 0x0, "文泉驿微米黑", 16, 0);
	wMButton3->setPressedStyle(8, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton3->setReleasedArg(">", 0x0, "文泉驿微米黑", 16, 0);
	wMButton3->setReleasedStyle(5, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);

	/*----------------------------- Button : wMButton4                   -----------------------------*/
	wMButton4 = new STTButton(p_rt, this, "wMButton4", 0);
	wMButton4->setMainArg(292, 1, 48, 28, false);
	wMButton4->setPressedArg(">|", 0x0, "文泉驿微米黑", 16, 0);
	wMButton4->setPressedStyle(8, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton4->setReleasedArg(">|", 0x0, "文泉驿微米黑", 16, 0);
	wMButton4->setReleasedStyle(5, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);

	/*----------------------------- Button : wMButton5                   -----------------------------*/
	wMButton5 = new STTButton(p_rt, this, "wMButton5", 0);
	wMButton5->setMainArg(375, 1, 48, 28, false);
	wMButton5->setPressedArg("继续", 0x0, "文泉驿微米黑", 16, 0);
	wMButton5->setPressedStyle(8, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton5->setReleasedArg("继续", 0x0, "文泉驿微米黑", 16, 0);
	wMButton5->setReleasedStyle(5, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);

	/*----------------------------- Button : wMButton6                   -----------------------------*/
	wMButton6 = new STTButton(p_rt, this, "wMButton6", 0);
	wMButton6->setMainArg(117, 571, 48, 28, false);
	wMButton6->setPressedArg("|<", 0x0, "文泉驿微米黑", 16, 0);
	wMButton6->setPressedStyle(8, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton6->setReleasedArg("|<", 0x0, "文泉驿微米黑", 16, 0);
	wMButton6->setReleasedStyle(5, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);

	/*----------------------------- Button : wMButton7                   -----------------------------*/
	wMButton7 = new STTButton(p_rt, this, "wMButton7", 0);
	wMButton7->setMainArg(166, 571, 48, 28, false);
	wMButton7->setPressedArg("<", 0x0, "文泉驿微米黑", 16, 0);
	wMButton7->setPressedStyle(8, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton7->setReleasedArg("<", 0x0, "文泉驿微米黑", 16, 0);
	wMButton7->setReleasedStyle(5, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);

	/*----------------------------- Button : wMButton8                   -----------------------------*/
	wMButton8 = new STTButton(p_rt, this, "wMButton8", 0);
	wMButton8->setMainArg(215, 571, 48, 28, false);
	wMButton8->setPressedArg(">", 0x0, "文泉驿微米黑", 16, 0);
	wMButton8->setPressedStyle(8, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton8->setReleasedArg(">", 0x0, "文泉驿微米黑", 16, 0);
	wMButton8->setReleasedStyle(5, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);

	/*----------------------------- Button : wMButton9                   -----------------------------*/
	wMButton9 = new STTButton(p_rt, this, "wMButton9", 0);
	wMButton9->setMainArg(264, 571, 48, 28, false);
	wMButton9->setPressedArg(">|", 0x0, "文泉驿微米黑", 16, 0);
	wMButton9->setPressedStyle(8, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton9->setReleasedArg(">|", 0x0, "文泉驿微米黑", 16, 0);
	wMButton9->setReleasedStyle(5, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);

	/*----------------------------- Button : wMButton10                  -----------------------------*/
	wMButton10 = new STTButton(p_rt, this, "wMButton10", 0);
	wMButton10->setMainArg(347, 571, 48, 28, false);
	wMButton10->setPressedArg("继续", 0x0, "文泉驿微米黑", 16, 0);
	wMButton10->setPressedStyle(8, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton10->setReleasedArg("继续", 0x0, "文泉驿微米黑", 16, 0);
	wMButton10->setReleasedStyle(5, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);

	/*----------------------------- Button : wMButton11                  -----------------------------*/
	wMButton11 = new STTButton(p_rt, this, "wMButton11", 0);
	wMButton11->setMainArg(828, 571, 48, 28, false);
	wMButton11->setPressedArg("|<", 0x0, "文泉驿微米黑", 16, 0);
	wMButton11->setPressedStyle(8, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton11->setReleasedArg("|<", 0x0, "文泉驿微米黑", 16, 0);
	wMButton11->setReleasedStyle(5, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);

	/*----------------------------- Button : wMButton12                  -----------------------------*/
	wMButton12 = new STTButton(p_rt, this, "wMButton12", 0);
	wMButton12->setMainArg(877, 571, 48, 28, false);
	wMButton12->setPressedArg("<", 0x0, "文泉驿微米黑", 16, 0);
	wMButton12->setPressedStyle(8, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton12->setReleasedArg("<", 0x0, "文泉驿微米黑", 16, 0);
	wMButton12->setReleasedStyle(5, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);

	/*----------------------------- Button : wMButton13                  -----------------------------*/
	wMButton13 = new STTButton(p_rt, this, "wMButton13", 0);
	wMButton13->setMainArg(926, 571, 48, 28, false);
	wMButton13->setPressedArg(">", 0x0, "文泉驿微米黑", 16, 0);
	wMButton13->setPressedStyle(8, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton13->setReleasedArg(">", 0x0, "文泉驿微米黑", 16, 0);
	wMButton13->setReleasedStyle(5, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);

	/*----------------------------- Button : wMButton14                  -----------------------------*/
	wMButton14 = new STTButton(p_rt, this, "wMButton14", 0);
	wMButton14->setMainArg(975, 571, 48, 28, false);
	wMButton14->setPressedArg(">|", 0x0, "文泉驿微米黑", 16, 0);
	wMButton14->setPressedStyle(8, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton14->setReleasedArg(">|", 0x0, "文泉驿微米黑", 16, 0);
	wMButton14->setReleasedStyle(5, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);

	/*----------------------------- Button : wMButton15                  -----------------------------*/
	wMButton15 = new STTButton(p_rt, this, "wMButton15", 0);
	wMButton15->setMainArg(828, 1, 48, 28, false);
	wMButton15->setPressedArg("|<", 0x0, "文泉驿微米黑", 16, 0);
	wMButton15->setPressedStyle(8, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton15->setReleasedArg("|<", 0x0, "文泉驿微米黑", 16, 0);
	wMButton15->setReleasedStyle(5, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);

	/*----------------------------- Button : wMButton16                  -----------------------------*/
	wMButton16 = new STTButton(p_rt, this, "wMButton16", 0);
	wMButton16->setMainArg(877, 1, 48, 28, false);
	wMButton16->setPressedArg("<", 0x0, "文泉驿微米黑", 16, 0);
	wMButton16->setPressedStyle(8, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton16->setReleasedArg("<", 0x0, "文泉驿微米黑", 16, 0);
	wMButton16->setReleasedStyle(5, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);

	/*----------------------------- Button : wMButton17                  -----------------------------*/
	wMButton17 = new STTButton(p_rt, this, "wMButton17", 0);
	wMButton17->setMainArg(926, 1, 48, 28, false);
	wMButton17->setPressedArg(">", 0x0, "文泉驿微米黑", 16, 0);
	wMButton17->setPressedStyle(8, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton17->setReleasedArg(">", 0x0, "文泉驿微米黑", 16, 0);
	wMButton17->setReleasedStyle(5, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);

	/*----------------------------- Button : wMButton18                  -----------------------------*/
	wMButton18 = new STTButton(p_rt, this, "wMButton18", 0);
	wMButton18->setMainArg(975, 1, 48, 28, false);
	wMButton18->setPressedArg(">|", 0x0, "文泉驿微米黑", 16, 0);
	wMButton18->setPressedStyle(8, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton18->setReleasedArg(">|", 0x0, "文泉驿微米黑", 16, 0);
	wMButton18->setReleasedStyle(5, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);

	/*----------------------------- TextNumber : wMTextNumber1           -----------------------------*/
	wMTextNumber1 = new STTTextArea(p_rt, this, "wMTextNumber1");
	wMTextNumber1->setMainArg(512, 0, 239, 28, false, true, TextAlign::CENTER, -1, -1, -99999999, 99999999, false);
	wMTextNumber1->setMainStyle(7, 0xffffff, 0xffffff, 0, 2, 0xc0c0c0, 3, 3, 4, 4, 255);
	wMTextNumber1->setPlaceholderText("起始YYYYMMDDhhmmss")->setMaxLength(0)->setAcceptedChars("")->setImeMode(IME::DIGITAL);
	wMTextNumber1->setFont(0x0, 12, "文泉驿微米黑", 0);

	/*----------------------------- TextNumber : wMTextNumber2           -----------------------------*/
	wMTextNumber2 = new STTTextArea(p_rt, this, "wMTextNumber2");
	wMTextNumber2->setMainArg(511, 26, 240, 28, false, true, TextAlign::CENTER, -1, -1, -99999999, 99999999, false);
	wMTextNumber2->setMainStyle(7, 0xffffff, 0xffffff, 0, 2, 0xc0c0c0, 3, 3, 4, 4, 255);
	wMTextNumber2->setPlaceholderText("截止YYYYMMDDhhmmss")->setMaxLength(0)->setAcceptedChars("")->setImeMode(IME::DIGITAL);
	wMTextNumber2->setFont(0x0, 12, "文泉驿微米黑", 0);

	/*----------------------------- Button : wMButton19                  -----------------------------*/
	wMButton19 = new STTButton(p_rt, this, "wMButton19", 0);
	wMButton19->setMainArg(761, 1, 57, 50, false);
	wMButton19->setPressedArg("查询", 0x0, "文泉驿微米黑", 16, 0);
	wMButton19->setPressedStyle(8, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	wMButton19->setReleasedArg("查询", 0x0, "文泉驿微米黑", 16, 0);
	wMButton19->setReleasedStyle(5, 255, 0xebebeb, 0x999999, 1, 1, 0x999999, 1, 0xebebeb);
	/*called after widget created.*/

	return; //createParts END
}

void Frm10::onLoad() {

}

bool Frm10::onClosing() {
	return true;
}

void Frm10::onDispose() {

}

void Frm10::wMButton1_clk_cb(uint16_t code, LvEvent e) {
	/*wMButton1（|<）的点击事件*/
	this->wMHistoryTrend1->navFirst();
}
